home *** CD-ROM | disk | FTP | other *** search
/ Georgia Wildfire Prevention / Georgia Wildfire Prevention.iso / mac / media / dirs / BackUp / WildFire.dir / 00008_Script_AnswerGod < prev    next >
Text File  |  2002-10-15  |  919b  |  27 lines

  1. --ANSWER GOD--
  2. property QuestionList
  3.  
  4. on new me 
  5.   return me
  6. end
  7.  
  8. --This handler causes the object to check which questions are available and asks one at random.
  9. on AskQuestion me
  10.   QuestionList = []
  11.   sendallsprites (#AvailableQuestions)
  12.   set TotalQuestions = count(QuestionList)  --Counts the number of elements in the question list.
  13.   set RandomQuestion = random(TotalQuestions) --Using the number of elements, a random one is picked.
  14.   if QuestionList <> [] then
  15.     set NextQuestion = getat(QuestionList, RandomQuestion)  --Sets NestQuestion equal to the SpNum of the question.
  16.     sendallsprites(#LightsOut, NextQuestion) --Tells the question to appear. 
  17.     updatestage
  18.   else
  19.     go next
  20.   end if
  21. end
  22.  
  23. --This function takes the questions availibilty response and stores it in the QuestionList.
  24. on AvailabilityResponse me, AvailableQuestion
  25.   add (QuestionList, AvailableQuestion)
  26. end
  27.